<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="<%=basePath%>Js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/mycss/bootstrap.min.css" />

</head>

<script type="text/javascript">

//取消预约
function cancelSubscribe(roomNumber){
	
	if(confirm("是否确定取消预约")){
	$.ajax({
		type:"post",
		url:"cancelSubscribe.do",
		async: false,
		data:{
			"roomNumber":roomNumber,
		},
		dataType:"text",
		success:function(result){
			if(result == "1"){
				alert("取消预约成功")
			}else{
				alert("取消预约失败")
			}
		},
		error:function(){
			alert("系统故障")
		}
	})
	
	}
}

</script>

<body>
<br><br>
<c:if test="${fn:length(pageInfo.list) !=0}">
<h3>您已预约${fn:length(pageInfo.list)}个房间</h3>
</c:if>
<c:if test="${fn:length(pageInfo.list) ==0}">
<h3>您没有预约的房间</h3>
</c:if>
<br><br>
	<table class="table table-hover" id="roomTable">

		<tr>
			<th>房间号</th>
			<th>楼层</th>
			<th>价格</th>
			<th>房型</th>
			<th>状态</th>
			<th>容纳人数</th>
			<th>备注</th>
			<th>操作</th>
		</tr>
		<c:forEach items="${pageInfo.list}" var="roomlist">

			<tr>
				<td>${roomlist.roomnum}</td>
				<td>${roomlist.floor}</td>
				<td>${roomlist.price}</td>
				<td>${roomlist.type}</td>
				<td>${roomlist.status}</td>
				<td>${roomlist.quantity}</td>
				<td>${roomlist.remark}</td>
				<td><a href="" onclick="cancelSubscribe('${roomlist.roomnum}')">取消预约</a>
				</td>
			</tr>

		</c:forEach>
	</table>
	<div id="page1">
	<c:if test="${!pageInfo.isFirstPage && !empty pageInfo}">
					<a href="${pageContext.request.contextPath }/querySubscribeRoom.do">首页</a>
					<a href="${pageContext.request.contextPath }/querySubscribeRoom.do?pageNum=${pageInfo.prePage}">上一页</a>
				</c:if>
				<c:if test="${!pageInfo.isLastPage }">
				<a href="${pageContext.request.contextPath }/querySubscribeRoom.do?pageNum=${pageInfo.nextPage}">下一页</a>
				<a href="${pageContext.request.contextPath }/querySubscribeRoom.do?pageNum=${pageInfo.lastPage}">末页</a>
				</c:if>
				当前页：${pageInfo.pageNum }/${pageInfo.pages }.
				</div>
				





</body>
</html>